package com.lc1993929.util;

/**
 * Created by LiuChang on 2017/5/5.
 */

import com.lc1993929.entity.ReceiveXmlEntity;

import java.util.Date;

/**
 * 封装返回给微信端的xml数据
 */
public class FormatXmlResult {
    /**
     * 封装xml结果数据
     */
    public static String getXmlResult(ReceiveXmlEntity xml, String tlResult) {
        StringBuffer sb = new StringBuffer();
        sb.append("<xml><ToUserName><![CDATA[");
        sb.append(xml.getFromUserName());
        sb.append("]]></ToUserName> <FromUserName><![CDATA[");
        sb.append(xml.getToUserName());
        sb.append("]]></FromUserName > <CreateTime >");
        sb.append(new Date().getTime());
        sb.append("</CreateTime > <MsgType ><![CDATA[text]]></MsgType > <Content ><![CDATA[");
        sb.append(tlResult);
        sb.append("]]></Content >< / xml > ");

        return sb.toString();
    }
}
